package com.hu.zhcc.shiro.service.HealthIntervention;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.dao.IndexmanagementMapper;
import com.hu.zhcc.shiro.entity.bo.HealthIntervention.Indexmanagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class IndexmanagementServiceImpl implements IndexmanagementService {
    @Autowired
    private IndexmanagementMapper mapper;
    @Override
    public int deleteByPrimaryKey(Integer indexId) {
        return mapper.deleteByPrimaryKey(indexId);
    }

    @Override
    public int insertSelective(Indexmanagement record) {
        return mapper.insertSelective(record);
    }

    @Override
    public Indexmanagement selectByPrimaryKey(Integer indexId) {
        return mapper.selectByPrimaryKey(indexId);
    }

    @Override
    public Page<Indexmanagement> selectPageList(Map map , int offset , int limit) {
        PageHelper.startPage(offset,limit);
        List<Indexmanagement> indexmanagements = mapper.selectAllList(map);
        PageInfo<Indexmanagement> info = new PageInfo<>(indexmanagements);
        return new Page<>(info.getTotal(),indexmanagements) ;
    }

    @Override
    public int updateByPrimaryKeySelective(Indexmanagement record) {
        return mapper.updateByPrimaryKeySelective(record);
    }
}
